import 'dart:convert' show json;

class SpaceUser {

  int followers;
  int following;
  int gold;
  int price;
  int sex;
  int uid;
  int verify;
  int vip;
  int visitors;
  String birth;
  String city;
  String country;
  String code;
  String icon;
  String logtime;
  String nickname;
  String regtime;
  String signtext;
  String video;
  List<String> img;

  SpaceUser.fromParams({this.followers, this.code,this.following, this.gold, this.price, this.sex, this.uid, this.verify, this.vip, this.visitors, this.birth, this.city, this.country, this.icon, this.logtime, this.nickname, this.regtime, this.signtext, this.video, this.img});

  factory SpaceUser(jsonStr) => jsonStr == null ? null : jsonStr is String ? new SpaceUser.fromJson(json.decode(jsonStr)) : new SpaceUser.fromJson(jsonStr);

  SpaceUser.fromJson(jsonRes) {
    followers = jsonRes['followers'];
    following = jsonRes['following'];
    gold = jsonRes['gold'];
    price = jsonRes['price'];
    sex = jsonRes['sex'];
    uid = jsonRes['uid'];
    verify = jsonRes['verify'];
    vip = jsonRes['vip'];
    visitors = jsonRes['visitors'];
    birth = jsonRes['birth'];
    city = jsonRes['city'];
    country = jsonRes['country'];
    code = jsonRes['code'];
    icon = jsonRes['icon'];
    logtime = jsonRes['logtime'];
    nickname = jsonRes['nickname'];
    regtime = jsonRes['regtime'];
    signtext = jsonRes['signtext'];
    video = jsonRes['video'];
    img = jsonRes['img'] == null ? null : [];

    for (var imgItem in img == null ? [] : jsonRes['img']){
      img.add(imgItem);
    }
  }

  @override
  String toString() {
    return '{"followers": $followers,"following": $following,"gold": $gold,"price": $price,"sex": $sex,"uid": $uid,"verify": $verify,"vip": $vip,"visitors": $visitors,"birth": ${birth != null?'${json.encode(birth)}':'null'},"city": ${city != null?'${json.encode(city)}':'null'},"country": ${country != null?'${json.encode(country)}':'null'},"icon": ${icon != null?'${json.encode(icon)}':'null'},"logtime": ${logtime != null?'${json.encode(logtime)}':'null'},"nickname": ${nickname != null?'${json.encode(nickname)}':'null'},"regtime": ${regtime != null?'${json.encode(regtime)}':'null'},"signtext": ${signtext != null?'${json.encode(signtext)}':'null'},"video": ${video != null?'${json.encode(video)}':'null'},"img": $img}';
  }
}

